<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Elvia后台管理系统</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Access-Control-Allow-Origin" content="*">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="icon" href="favicon.ico">
	<link rel="stylesheet" href="layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="css/index.css" media="all" />
</head>
<body class="main_body">
	<div class="layui-layout layui-layout-admin">
		<!-- 顶部 -->
		<div class="layui-header header">
			<div class="layui-main mag0">
				<a class="logo">Elvis 管理系统</a>
				<!-- 显示/隐藏菜单 -->
				<a href="javascript:;" class="seraph hideMenu icon-caidan"></a>
			    <!-- 顶部右侧菜单 -->
			    <ul class="layui-nav top_menu">
					<li class="layui-nav-item" id="userInfo">
						<a href="javascript:;"><img src="images/face.png" class="layui-nav-img userAvatar" width="35" height="35"><cite class="adminName" id="adminName"></cite></a>
						<dl class="layui-nav-child">
							<dd pc><a href="javascript:;" class="changeSkin"><i class="layui-icon">&#xe61b;</i><cite>更换皮肤</cite></a></dd>
							<dd><a href="http://192.168.1.123:8080/page/cpts_1924_cyb/index.html"><i class="layui-icon">&#xe68e;</i><cite>网站首页</cite></a></dd>
							<dd><a href="page/login/login.html" class="signOut"><i class="seraph icon-tuichu"></i><cite>退出</cite></a></dd>
						</dl>
					</li>
				</ul>
			</div>
		</div>
		<!-- 左侧导航 -->
		<div class="layui-side layui-bg-black">
			<div class="user-photo">
				<a class="img" title="我的头像" ><img src="images/face.png" class="userAvatar"></a>
				<p>欢迎登录</p>
			</div>
			<div class="navBar layui-side-scroll" id="navBar">
				<ul class="layui-nav layui-nav-tree" id="tree">
					<li class="layui-nav-item layui-nav-itemed">
						<a class="" href="javascript:;" style="display: none" id="ppmk">品牌模块</a>
						<dl class="layui-nav-child">
							<dd><a href="/page/apply/apply.html" target="user" style="display: none" id="sqgl">申请管理</a></dd>
							<dd><a href="/page/brand/brand.html" target="user" style="display: none" id="ppgl">品牌管理</a></dd>
							<dd><a href="" target="user" style="display: none" id="cpgl">产品管理</a></dd>
						</dl>
					</li>
					<li class="layui-nav-item">
						<a href="javascript:;" style="display: none" id="yhmk">用户模块</a>
						<dl class="layui-nav-child">
							<dd><a href="/page/comment/comment.html" target="user" style="display: none" id="plgl">评论管理</a></dd>
							<dd><a href="/page/contact/contact.html" target="user" style="display: none" id="jygl">建议管理</a></dd>
							<dd><a href="/page/introduce/introduce.html" target="user" style="display: none" id="jshgl">介绍管理</a></dd>
						</dl>
					</li>
					<li class="layui-nav-item">
						<a href="javascript:;" style="display: none" id="qxmk">权限模块</a>
						<dl class="layui-nav-child">
							<dd><a href="/page/user/user.html" target="user" style="display: none" id="yhgl">用户管理</a></dd>
							<dd><a href="/page/role/role.html" target="user" style="display: none" id="jsgl">角色管理</a></dd>
						</dl>
					</li>
				</ul>
			</div>
		</div>
		<!-- 右侧内容 -->
		<div class="layui-body">
			<iframe src="page/main.html"></iframe>
		</div>
		<!-- 底部 -->
		<div class="layui-footer footer">
			<p><span>Copyright ©2019 Elvia化妆品宣传网站</span></p>
		</div>
	</div>

	<script type="text/javascript" src="layui/layui.js"></script>
	<script type="text/javascript" src="js/cache.js"></script>
	<script type="text/javascript" >
        //从当前页面的url地址中获取参数数据
        function getRequest() {
            var url = location.search; //获取url中"?"符后的字串
            var theRequest = new Object();
            if(url.indexOf("?") != -1) {
                var str = url.substr(1);
                strs = str.split("&");
                for(var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                }
            }
            return theRequest;
        }

	</script>
	<script type="text/javascript">
	var $,tab,dataStr,layer;
	layui.config({
		base : "js/"
	}).extend({
		"bodyTab" : "bodyTab"
	})
	layui.use(['bodyTab','form','element','layer','jquery'],function(){
		var form = layui.form,
			element = layui.element;
			$ = layui.$;
        var request = getRequest();
        var username = request.username;
		$("#adminName").html(username);
        layer = parent.layer === undefined ? layui.layer : top.layer;

        $.ajax({
			url:'/product/getBid?username=' + username,
			type:'get'
            ,success: function (data) {
                $("#cpgl").attr("href","/page/product/product.html?username=" + username+"&bid="+data.data);
			}
		});

        $.ajax({
            url: '/menu/showAll?username=' + username,
            type: 'get',
            dataType: 'json',
            success: function (data) {
                $(data.data).each(function (i, n) {
                    if(n.menuName==="品牌模块"){
                        document.getElementById("ppmk").style.display="";
					}else if(n.menuName==="品牌管理"){
                        document.getElementById("ppgl").style.display="";
                    }else if(n.menuName==="申请管理"){
                        document.getElementById("sqgl").style.display="";
                    }else if(n.menuName==="用户模块"){
                        document.getElementById("yhmk").style.display="";
                    }else if(n.menuName==="评论管理"){
                        document.getElementById("plgl").style.display="";
                    }else if(n.menuName==="建议管理"){
                        document.getElementById("jygl").style.display="";
                    }else if(n.menuName==="权限模块"){
                        document.getElementById("qxmk").style.display="";
                    }else if(n.menuName==="用户管理"){
                        document.getElementById("yhgl").style.display="";
                    }else if(n.menuName==="角色管理"){
                        document.getElementById("jsgl").style.display="";
                    }else if(n.menuName==="产品管理"){
                        document.getElementById("cpgl").style.display="";
                    }else if(n.menuName==="介绍管理"){
                        document.getElementById("jshgl").style.display="";
                    }
                })
            }
        });
		//通过顶部菜单获取左侧菜单
		$(".topLevelMenus li,.mobileTopLevelMenus dd").click(function(){
			if($(this).parents(".mobileTopLevelMenus").length != "0"){
				$(".topLevelMenus li").eq($(this).index()).addClass("layui-this").siblings().removeClass("layui-this");
			}else{
				$(".mobileTopLevelMenus dd").eq($(this).index()).addClass("layui-this").siblings().removeClass("layui-this");
			}
			$(".layui-layout-admin").removeClass("showMenu");
			$("body").addClass("site-mobile");
			getData($(this).data("menu"));
		})

		//隐藏左侧导航
		$(".hideMenu").click(function(){
			if($(".topLevelMenus li.layui-this a").data("url")){
				layer.msg("此栏目状态下左侧菜单不可展开");  //主要为了避免左侧显示的内容与顶部菜单不匹配
				return false;
			}
			$(".layui-layout-admin").toggleClass("showMenu");
		})
	})
	</script>
</body>
</html>